import request from '@/utils/request'

// 收藏的歌手列表
export const artistSublist = (params?: any) => {
  return request({
    url: '/artist/sublist',
    method: 'get',
    params
  })
}

// 收藏的mv列表
export const mvSublist = (params?: any) => {
  return request({
    url: '/mv/sublist',
    method: 'get',
    params
  })
}

// 获取用户歌单
export const playlist = (params?: any) => {
  return request({
    url: '/user/playlist',
    method: 'get',
    params
  })
}

// 获取歌单详情
export const detail = (params?: any) => {
  return request({
    url: '/playlist/detail',
    method: 'get',
    params
  })
}

// 根据ids获取歌单详情
export const getsongDetail = (ids?: Array<number>) => {
  return request({
    url: '/song/detail?ids=' + ids,
    method: 'get'
  })
}

// 对歌单添加或删除歌曲
// op: 从歌单增加单曲为 add, 删除为 del
// pid: 歌单 id tracks: 歌曲 id,可多个,用逗号隔开
export const tracks = (params?: any) => {
  return request({
    url: '/playlist/tracks',
    method: 'get',
    params
  })
}

// 收藏/取消收藏歌单
// t:类型,1:收藏,2:取消收藏 id : 歌单 id
export const subscribe = (params?: any) => {
  return request({
    url: '/playlist/subscribe',
    method: 'get',
    params
  })
}

// 新建歌单
export const playlistCreate = (params?: any) => {
  return request({
    url: '/playlist/create',
    method: 'get',
    params,
  })
}

// 删除歌单
export const playlistDelete = (params?: any) => {
  return request({
    url: '/playlist/delete',
    method: 'get',
    params,
  })
}
// 音乐是否可用
// 说明: 调用此接口,传入歌曲 id, 可获取音乐是否可用,返回 { success: true, message: 'ok' } 或者 { success: false, message: '亲爱的,暂无版权' }
export const checkMusic = (params?: any) => {
  return request({
    url: '/check/music',
    method: 'get',
    params,
  })
}